<template>
	<view class="content">
		<view class="gui-bg-white">
			<view class="gui-margin-x gui-bold text-center" style="font-size:36rpx;">
			{{info.title}}
			</view>
			<view class="gui-text gui-margin-x gui-margin-top gui-block" style="float: right;">{{info.crtTime}}</view>
			<view class="" v-if="article.length <= 0" style="text-align: center; margin-top: 50rpx;">
				暂无数据
			</view>
			<view style="width: 98%;" v-else>
				<view class="gui-bg-white gui-dark-bg-level-3 gui-padding">
					<rich-text :nodes="article"></rich-text>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import parserHtml from "@/Grace6/js/parserHTML.js";
	export default {
		data() {
			return {
				id: 0,
				info: [],
				baseUrl: 'https://app.lgwisdomunion.cn',
				article: [],
				
			}
		},
		onLoad(opt) {
			this.id = opt.id
			if(opt.hasOwnProperty("title")){
				uni.setNavigationBarTitle({
					title:opt.title
				})
			}
			this.getData();
			
		},
		methods: {
			getData(d=null) {
				let self = this
				console.log('id: ', self.id)
				
				this.$boya.NGet("/app/get_notice", {id:self.id}, (res) => {
					console.log('res: ', res)
					self.info = res.data
					console.log('info: ', self.info)
					self.article = parserHtml.parserHTML(res.data.content);
					for (let i in self.article) {
						let m = self.article[i].children
						// console.log("m",m)
						for (let key in m) {
							let c = m[key].attrs
							if(c==undefined) continue;
							if(c.hasOwnProperty("src")){
								let imgPath = self.baseUrl + c.src
								self.article[i].children[key].attrs.src = imgPath
							}
							// console.log("imgPath",imgPath)
							// console.log("c", c)
						}
					}
					console.log('shuju: ', self.article);
				})
			}
		}
	}
</script>
<style>
	img {
		width: 100vw;
		margin-left: -28rpx;
	}
</style>